import { JsonController, Authorized, Body, HeaderParam, Get, Post, UseBefore, QueryParam} from 'routing-controllers';
import { RequestLog } from '@/middleware/requestLog'
import { Inject, Service } from 'typedi';
import { uploadOssHelper } from '@/utils/aliyunOss';
import { JsonResult, msgList, res } from '@/utils/jsonResult';
import config from '@/config'

@Service()
@JsonController(config.setPrefix("admin/lib"))
export class MenuController {

  @Inject()
  json!: JsonResult<any>;


  @Get('/aliyunToken')
  @UseBefore(RequestLog)
  async getAliyunOssToken() {
    let alyunHelper = new uploadOssHelper({
        accessKeyId: config.aliyunOssConfig.accessKeyId,
        accessKeySecret: config.aliyunOssConfig.accessKeySecret
    })
    return this.json.success(alyunHelper.createUploadParams());
  }

}